<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
  <head>
    <title>Lucar 注册</title>
  </head>
  
<link rel="stylesheet" type="text/css" href="lucar-css/head-css.css" />
<link rel="stylesheet" type="text/css" href="lucar-css/register-css.css" />

<body>
	<div id="head">
    	<div id="h-logo">
        	<img src="lucar-image/logo.png" class="hl">
        </div>
        <div id="h-right">
        	<span id="hr-useCar" class="hr-span" onmouseover="headimg(1);" onMouseOut="headimg(2);">
            	<img id="uCOut" src="lucar-image/useCar-Out.png" class="hr-image" style="display:block">
            	<img id="uCOn" src="lucar-image/useCar-On.png" class="hr-image" style="display:none">
            </span>
            <span id="hr-aboutUs" class="hr-span" onmouseover="headimg(3);" onMouseOut="headimg(4);">
            	<img id="aUOut" src="lucar-image/aboutUs-Out.png" class="hr-image" style="display:block">
            	<img id="aUOn" src="lucar-image/aboutUs-On.png" class="hr-image" style="display:none">
            </span>
            <span id="mainJsp" class="button" onMouseOver="headbutton(1);" onMouseOut="headbutton(2);" onclick="window.location.href='index.jsp'"><b class="hr-text" >主页</b></span>
        </div>
    </div>
    <div id="register-body">
    	<s:form id="rb-list" action="Register" namespace="/">
        	<div class="textwindow">
        		<span id="ss" style=" color: red ;font-size: 14px;" ></span>
            	<p>账号：</p>
                <div class="textwindow2">
                	<s:textfield name="user.userId" label="账号" id="userId" />
                </div>
                <span id="uID1" class="information">你的用户名过长，不允许注册！</span>
                <span id="uID2" class="information">你的用户名存在中文，不允许注册！</span>
                <span id="uID3" class="information">用户名不能为空！</span>
            </div>
            <div class="textwindow">
            	<p>密码：</p>
                <div class="textwindow2">
                	<s:password  name="use.upassword" label="密码" id="uPassword"/>
                </div>
                <span id="uP1" class="information">密码不能为空！</span>
            </div>
            <div class="textwindow">
            	<p>再次输入账号：</p>
                <div class="textwindow2">
                	<s:textfield name="use.userId" label="账号" id="userId_second"/>
                </div>
            </div>
            <div class="textwindow">
            	<p>姓名：</p>
                <div class="textwindow2">
                	<s:textfield name="user.name" label="姓名" id="name"/>
                </div>
                <span id="n1" class="information">姓名不能为空！</span>
            </div>
            <div class="textwindow">
            	<p>性别：</p>
                <div class="textwindow3" style="witdh:200px;">
                	<s:textfield name="user.sex" label="性别" id="sex"/>
                </div>
                <p style="margin-left:330px;">年龄：</p>
                <div class="textwindow3" style="width:200px; margin-left:380px;">
                	<s:textfield name="user.age" label="年龄" id="age"/>
                </div>
                <span id="a1" class="information">请正经填写年龄！</span>
            </div>
            <div class="textwindow">
            	<p>电话：</p>
                <div class="textwindow2">
                	<s:textfield name="user.phone" label="电话号码" id="phone"/>
                </div>
                <span id="p1" class="information">电话不能为空！</span>
                <span id="p2" class="information">请正经填写电话！</span>
            </div>
            <div class="textwindow">
            	<p>身份证号：</p>
                <div class="textwindow2">
                	<s:textfield name="user.icNo" label="身份证号" id="icNo"/>
                </div>
                <span id="iN1" class="information">身份证号不能为空！</span>
                <span id="iN2" class="information">请正经填写身份证！</span>
            </div>
            <div class="textwindow">
            	<p>驾驶证号：</p>
                <div class="textwindow2">
                	<s:textfield name="user.dlNo" label="驾驶证号" id="dlNo"/>
                </div>
                <span id="dN1" class="information">驾驶证号不能为空！</span>
                <span id="dN2" class="information">请正经填写驾驶证号！</span>
            </div>
            <div id="Read">
            	<input type="checkbox" id="read" />
               	 我已同意<a href="#">《Lucar用户使用协议》</a>和<a href="#">《Lucar账号中心规范》</a>
            </div>
            <div id="rbutton">
        		<span>注册</span>
        	</div>
        </s:form>
        <img src="lucar-image/register-image/registericon.png" width="100px" height="60px" style="position:absolute; left:435px;"/>
    </div>
</body>
<script src="lucar-script/head-script.js"></script>
<script src="lucar-script/register-script.js"></script>
<script src="lucar-script/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
window.onload = function(){
	function box(){
		var oBox = document.getElementById("register-body");
		var L1 = oBox.offsetWidth;
		var Left = (document.documentElement.clientWidth-L1)/2;
		oBox.style.left = Left+'px';
	}
	box();
	window.onresize = function(){
        box();
    }
}
$(document).ready(function(){
	$("#userId").blur(function(){
		var userId=$("#userId").val();
		$.ajax({
			type:"get",
			url:'<%=basePath%>ASelect.action',
			data:"userId="+userId,
			dataType:"json",
			success:function(userList){
				if(userList.length!=0){
					$("#ss").text("该账号已存在！");
				}else{
					$("#ss").text("");
				}
			},
			error:function(userList){
				alert("未知错误！");
			}
		});
	});
})
</script>

</html>
